<?php   // $Id: index.php 314 2008-11-01 22:03:06Z pcoustillas $ 
/*Copyright (C) 2007 Pierre Coustillas
Licensed under the terms of the GNU  General Public License:http://www.opensource.org/licenses/gpl-license.php
File Authors:Pierre Coustillas */
?>

<?php 
$conf_xml=simplexml_load_file('include/config.xml');
$theme=$conf_xml->generale->theme;
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" lang="fr">
  <head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<title>Connection à OpenDCF</title>
	<link rel="stylesheet" type="text/css" href="include/themes/<?php echo "$theme";?>/style.css" />
	<link rel="shortcut icon" type="image/x-icon" href="image/favicon.ico" />
  </head>
<body>

<?php



//error_reporting(0);
require_once("include/debug.php"); //inclu par verif car verif est inclus presque partout.
require_once("include/config/common.php"); //meme si pas de connexion dans cette page, c'est bien de le laisser pour tester la connexion
require_once("include/config/var.php"); 
require_once("include/utils.php");

if (empty($host)) 
{
	echo "<h1>";
	aff_lang("Le logiciel ne semble pas encore avoir été configuré. Cliquez ");

	echo '<a href="installeur/index.php">' . get_lang("ici") . "</a> " . get_lang("pour le configurer dès maintenant.");
	
	echo "</h1>";


} else {

	if (!isset($lang))
	{
		$lang="fr";
	}

	if (isset($_GET['msg'])) {
		echo "<h2>" . $_GET['msg'] ."</h2>";
	}
	
	require_once("include/language/$lang.php");

	$admin=isset($_GET['admin'])?$_GET['admin']:"oui";


	if ($admin=="oui") {
		?><div style="text-align:left"><a href="index.php?admin=non">Connection Client</a><?php bouton_aide("connection_admin_client") ?></div><?php
	} else {
		?><div style="text-align:left"><a href="index.php?admin=oui">Connection Administrateur</a><?php bouton_aide("connection_admin_client") ?></div><?php
	}
	
	
	?>

	<br/>
	<br/>
	<br/>
	<br/>
	<br/>
	<br/>

	<form action="login.php?admin=<?php echo $admin ?>" method='post' name="frm_login">
		<table border="1" align="center">
			<tr>
				<td class="highlight_login" width="200" rowspan="3"><img src="image/<?php echo $logo ?>" alt="OpenDCF"/></td>
				<td class="highlight_login" width="120">
					<?php 
						aff_lang("Login"); echo " ";
						if ($admin=="oui") 
						{ 
							aff_lang("admin"); 
						} else {
							aff_lang("client");
						} 
			
					?>
				</td>
				<td class="highlight_login" width="200"><input type="text" name="login" maxlength="15"/></td>
			</tr>
			<tr>
				<td class="highlight_login"><?php aff_lang("Mot de passe")  ?></td>
				<td class="highlight_login"><input type="password" name="pass" maxlength="15"/></td>
			</tr><!--
			<tr> 
				<td class="highlight_login"><?php aff_lang("Langue") ?></td>
				<td class="highlight_login">
					<select name="lang">
						<option value="<?php echo "$default_lang" ?>"><?php echo "$lang_deflang" ?></option>
						<option value="fr">Francais</option>
						<option value="en">English</option>
						<option value="nl">Neederlands</option>
					</select>
				</td> 
			</tr>-->
			<tr class="submit">
				<td class="submit" colspan="3">
					<br/>
					<input name="submit" type="submit" value="      <?php aff_lang("Connexion") ?>      "/>
					<br/>&nbsp;
				</td>
			</tr>
			
		</table>
	</form>

	<script type="text/javascript">
		document.frm_login.login.focus();
	
	</script>

<?php
}

?>

</body>
</html>

